package ru.amse.tsyganov.jumleditor.properties;

import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ComboBoxCellEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Table;

public abstract class EnumProperty extends Property<Integer> {

	private final String[] elements;
	
	public EnumProperty(String[] elements) {
		this.elements = elements;
	}
	
	@Override
	public CellEditor createCellEditor(Table table) {
		return new ComboBoxCellEditor(table, elements, SWT.READ_ONLY);
	}

	public final String[] getElements() {
		return elements;
	}
	
	@Override
	public String getStringPropertyValue() {
		return elements[getPropertyValue()];
	}
}
